package com.boarsoft.message.sofamq;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SofaMQDestination {
	private static final Logger log = LoggerFactory.getLogger(SofaMQDestination.class);

	/** */
	protected SofaMQProducer producer;
	/** */
	protected SofaMQConsumer consumer;

	/** */
	protected String code;

	public void close() {
		if (producer != null) {
			try {
				producer.close();
			} catch (Exception e) {
				log.warn("Error on close producer {}", producer, e);
			}
		}
		if (consumer != null) {
			try {
				consumer.close();
			} catch (Exception e) {
				log.warn("Error on close consumer {}", consumer, e);
			}
		}
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public SofaMQProducer getProducer() {
		return producer;
	}

	public void setProducer(SofaMQProducer producer) {
		this.producer = producer;
	}

	public SofaMQConsumer getConsumer() {
		return consumer;
	}

	public void setConsumer(SofaMQConsumer consumer) {
		this.consumer = consumer;
	}
}
